﻿#include "cmodbusmapinfo.h"

CModbusMapInfo::CModbusMapInfo()

{}

void CModbusMapInfo::fromJson(QJsonObject obj)
{
    userid = obj["userid"].toString();
    mapid = obj["map_id"].toString();
    descr = obj["descr"].toString();
    modelName = obj["model_name"].toString();
    createtime = QDateTime::fromString(obj["create_time"].toString(), "yyyy-MM-dd hh:mm:ss");
}

QJsonObject CModbusMapInfo::toJson()
{
    QJsonObject obj;
    obj["map_id"] = mapid;
    obj["userid"] = userid;
    obj["model_name"] = modelName;
    obj["descr"] = descr;
    obj["create_time"] = createtime.toString("yyyy-MM-dd hh:mm:ss");
    return obj;
}
